package javase1.day08.demo02.day09.demo13;

import java.util.ArrayList;
//群主类
public class Manager extends User {
    public Manager(){

    }

    public Manager(String name, int money) {
        super(name, money);
    }
    public ArrayList<Integer> send(int toatalmoney,int count){
        ArrayList redlist=new ArrayList();
        //首先查看群主当前有多少钱
        int leftmoney=super.getMoney();
        if(leftmoney<toatalmoney){
            System.out.println("余额不足");
            return redlist;
        }
        //扣钱
        super.setMoney(leftmoney-toatalmoney);
        //平均分总金额
        int avg=toatalmoney/count;
        //除不开，余数
        int end=toatalmoney%count;
        for (int i = 0; i < count-1; i++) {
            redlist.add(avg);
        }
        int last=avg+end;
        redlist.add(last);
        return redlist;
    }
}
